CLASSPATH=/usr/share/java/junit.jar:po-uilib.jar:sonet-core-support.jar:sonet-textui-support.jar:./src:.
TESTS_MANAGER=./tests-manager-201111131556/
DIMPORT=$(TESTS_MANAGER)A-002-002-N-ok.import
#teste manager 1
MDIN1=$(TESTS_MANAGER)A-001-001-N-ok.in
MDOUT1=$(TESTS_MANAGER)1.out
MEXP1=$(TESTS_MANAGER)expected/A-001-001-N-ok.out
#teste manager 2
MDIN2=$(TESTS_MANAGER)A-002-002-N-ok.in
MDOUT2=$(TESTS_MANAGER)2.out
MEXP2=$(TESTS_MANAGER)expected/A-002-002-N-ok.out
#
TESTS_BROWSER=./tests-browser-201111131838/
#teste browser 1
BDIN1=$(TESTS_BROWSER)A-004-004-N-ok.in
BDOUT1=$(TESTS_BROWSER)2.out
BEXP1=$(TESTS_BROWSER)expected/A-004-004-N-ok.out
#
JAVACFLAGS= $(JAVAFLAGS) -encoding UTF-8
JAVAFLAGS= -cp "$(CLASSPATH)"
JAVADIR=
JARNAME=
MANAGER=sonet.textui.Manager
BROWSER=sonet.textui.Browser

all:
	(javac $(JAVAFLAGS) `find . -name \*.java`)
#	(cd src; jar cvf ../$(JARNAME).jar `find . -name \*.class -o -name \*.java`)

# run manager
m:
	(java  $(JAVAFLAGS) -DImport="$(DIMPORT)" $(MANAGER))

# run browser
b:
	(java  $(JAVAFLAGS) -DImport="$(DIMPORT)" $(BROWSER))

#test import
i1:
	(java $(JAVAFLAGS) -DImport="$(DIMPORT)" $(MANAGER))

#test manager 1	
tm1:	
	(java  $(JAVAFLAGS) -DImport="$(DIMPORT)" -Din="$(MDIN1)" -Dout="$(MDOUT1)" $(MANAGER))
	(diff -b "$(MDOUT1)" "$(MEXP1)")

#test manager 2	
tm2:
	(java $(JAVAFLAGS) -DImport="$(DIMPORT)" -Din="$(MDIN2)" -Dout="$(MDOUT2)" $(MANAGER))
	(diff -b "$(MDOUT2)" "$(MEXP2)")

#test browser 1
tb1:
	(java $(JAVAFLAGS) -DImport="$(DIMPORT)" -Din="$(BDIN1)" -Dout="$(BDOUT1)" $(BROWSER))
	(diff -b "$(BDOUT1)" "$(BEXP1)")


#test runners
test:
	(javac $(JAVAFLAGS) CreateAgentTest.java )
	(java $(JAVAFLAGS) junit.textui.TestRunner CreateAgentTest)


clean:
	$(RM) $(JARNAME).jar `find . -name \*.class`
